<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Ajax中POST方法提交参数</title>
</head>

<body>
    <button id="btn">点击提交</button>
    <div id="box"></div>
    <script src="./lib/jquery.js"></script>
    <script type="text/javascript">
        //点击按钮，向服务器发送请求
        $("#btn").click(function () {
            $.ajax({
                type: "POST",
                data: {
                    bookname: '金瓶梅',
                    author: 'cc',
                    publisher: 'yellow出版社'
                },
                dataType: "json",
                url: 'http://www.liulongbin.top:3006/api/addbook',
                success: function (res) {
                    $("#box").html(res.msg)
                }
            })
        })
    </script>
</body>

</html>